package com.gxd.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gxd.business.domain.Product;
import com.gxd.business.domain.qco.ProductQco;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author gxd
 * @since 2025/6/13
 */
public interface ProductMapper extends BaseMapper<Product> {


    /**
     * 分页列表-产品列表
     * @param page 分页参数
     * @param qco 产品查询条件
     * @return 产品列表
     */
    @Select({"<script> ",
            " select * ",
            " from t_product ",
            " where deleted = 0 ",
            "   <if test=\"qco.productName != null and qco.productName != ''\"> ",
            "       and product_name like concat('%', #{qco.productName} ,'%')",
            "   </if> ",
            "   <if test=\"qco.productType != null\"> ",
            "       and product_type = #{qco.productType}",
            "   </if> ",
            "   <if test=\"qco.status != null\"> ",
            "       and status = #{qco.status}",
            "   </if> ",
            "</script>"})
    Page<Product> pageList(Page<ProductQco> page, @Param("qco") ProductQco qco);

}
